package easy;

public class Solution_1893 {

    public boolean isCovered(int[][] ranges, int left, int right) {
        int[] array = new int[52];
        for (int[] range : ranges) {
            array[range[0]]++;
            array[range[1] + 1]--;
        }
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            count += array[i];
            if (i >= left && i <= right && count == 0) {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Solution_1893 model = new Solution_1893();
        System.out.println(model.isCovered(new int[][]{{1, 2}, {3, 4}, {5, 6}}, 2, 5));
        System.out.println(model.isCovered(new int[][]{{1, 10}, {10, 20}}, 21, 25));
        System.out.println(model.isCovered(new int[][]{{1, 10}, {10, 20}}, 21, 25));
    }
}
